{include file="public/header"/}
</head>
<body>
<div class="layui-form">
<div class="layui-fluid" id="LAY-component-layer-list">
<div class="layui-col-md12 pd83">
<div class="layui-card hideshadow">
  <div class="layui-tab layui-tab-brief">
  {include file="web/top"}
  <div class="layui-tab-content" style="padding:10px 0px;">

    <div class="layui-form-item">
        <label class="layui-form-label pcfcms_layui-form-label">会员中心</label>
        <div class="layui-input-inline pcfcms_layui-input-inline">
            <input type="checkbox" lay-filter="users_open" lay-skin="switch" lay-text="开启|关闭" {if condition="!isset($info.users_open) OR $info.users_open eq 1"}checked{/if}>
            <input type="hidden" id="users_open" name="users_open" value="{$info.users_open|default='0'}" />
            <p>关闭则自动隐藏账户注册/登录的入口</p>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label pcfcms_layui-form-label">开启注册</label>
        <div class="layui-input-inline pcfcms_layui-input-inline">
            <input type="checkbox" lay-filter="users_open_reg" lay-skin="switch" lay-text="开启|关闭" {if condition="!isset($info.users_open_reg) OR $info.users_open_reg eq 1"}checked{/if}>
            <input type="hidden" id="users_open_reg" name="users_open_reg" value="{$info.users_open_reg|default='0'}" />
            <p>关闭则自动隐藏账户注册的入口</p>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label pcfcms_layui-form-label">开启登陆</label>
        <div class="layui-input-inline pcfcms_layui-input-inline">
            <input type="checkbox" lay-filter="users_open_login" lay-skin="switch" lay-text="开启|关闭" {if condition="!isset($info.users_open_login) OR $info.users_open_login eq 1"}checked{/if}>
            <input type="hidden" id="users_open_login" name="users_open_login" value="{$info.users_open_login|default='0'}" />
            <p>关闭则自动隐藏账户登陆的入口</p>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label pcfcms_layui-form-label"> 注册验证</label>
        <div class="layui-input-inline pcfcms_layui-input-inline">
        <select name="users_verification" lay-verType="tips" lay-verify="required" required>
            {volist name="users_verification_list1" id="vo"}
            <option value="{$key}" {eq name="$info.users_verification" value="$key"}selected="true"{/eq}>{$vo}</option>
            {/volist}
        </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label pcfcms_layui-form-label"> 找回密码</label>
        <div class="layui-input-inline pcfcms_layui-input-inline">
        <select name="userspass_verification" lay-verType="tips" lay-verify="required" required>
            {volist name="users_verification_list2" id="vo"}
            <option value="{$key}" {eq name="$info.userspass_verification" value="$key"}selected="true"{/eq}>{$vo}</option>
            {/volist}
        </select>
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label pcfcms_layui-form-label">禁止注册用户名</label>
        <div class="layui-input-inline pcfcms_layui-input-inline">
            <textarea name="users_reg_notallow" placeholder="建议不超过200个字符" class="layui-textarea">{$info.users_reg_notallow}</textarea>
        </div>
    </div>

  </div>
  </div>
</div>
<div class="pcfclear"></div>
</div>
<div class="submit-info text-center">
    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
</div>
</div>
</div>
{include file="public/loading"/}
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form','element'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;

        // 监听开关
        form.on('switch', function(data){
            var elemId = data.elem.attributes['lay-filter']['nodeValue'];
            if (data.elem.checked) {
                this.value = 1;
            } else {
                this.value = 0;
            }
            $("#"+elemId).val(this.value);
        });

        //监听提交
        form.on('submit(formSubmit)', function(data){
            layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
            $.ajax({
                type : 'post',
                url : "{:url('/web/users_config')}",
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll();
                    if(res.status){
                        layer.msg(res.msg, {icon:1,time:1000}, function(){
                            window.location.reload();
                        });
                    }else{
                       layer.msg(res.msg, {icon:2,time:1000});
                    }
                },
                error: function(e){
                    layer.closeAll();
                    layer.msg(res.msg, {icon: 2,time:1000});
                }
            });
            return false;
        });

    });
</script>
</body>
</html>